package com.tarena.lbs.content.dao.repository.impl;

import com.tarena.lbs.content.dao.mapper.CategoryMapper;
import com.tarena.lbs.content.dao.repository.CategoryRepository;
import com.tarena.lbs.content.pojo.po.ArticleCategoryPO;
import com.tarena.lbs.content.pojo.query.ArticleCategoryQuery;
import com.tarena.lbs.content.pojo.vo.ArticleCategoryVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.sql.Wrapper;
import java.util.List;

@Slf4j
@Repository
public class CategoryRepositoryImpl implements CategoryRepository {
    @Autowired
    private CategoryMapper categoryMapper;
    @Override
    public List<ArticleCategoryPO> list() {
        return categoryMapper.list();
    }

    @Override
    public void insert(ArticleCategoryPO po) {
        categoryMapper.insert(po);
    }

    @Override
    public void updateCategory(ArticleCategoryPO po) {
        categoryMapper.updateCategory(po);
    }

    @Override
    public void deleteCategory(Integer id) {
        categoryMapper.deleteById(id);
    }

    @Override
    public List<ArticleCategoryVO> getCategory(ArticleCategoryQuery query) {
        System.out.println("---------------111-------"+query);
        List<ArticleCategoryVO> articleCategoryVOS = categoryMapper.selectCategory(query);
        System.out.println("---------------00000-------"+articleCategoryVOS.size());
        System.out.println("---------------222-------"+articleCategoryVOS);
        return  articleCategoryVOS;
    }


}
